package msu.ml.classification;
import weka.core.*;

/**
 * The DynamicInstances class provides an adapter for
 * using the Weka Instances class in the Nexrad
 * Explorer software.
 *
 * @author Reginald M Mead
 * @version 1.0
 */
public class DynamicInstances extends Instances 
{
   protected String sourceFile;
	protected FastVector hiddenAttributes;
	protected FastVector hiddenInstances;

	/**
	 * Constructor copying all instances and references to the header 
	 * information from the given set of instances.
	 *
	 * @param data the set to be copied 
	 */
   public DynamicInstances(Instances data)
   {
      super(data);
   }

	/**
	 * Creates an empty set of instances. Uses the given attribute information. 
	 * Sets the capacity of the set of instances to 0 if its negative. Given 
	 * attribute information must not be changed after this constructor 
	 * has been used.
	 *
	 * @param name the name of the relation
	 * @param attributes the attribute information
	 * @param capacity the capacity of the set
	 */
	public DynamicInstances(String name, FastVector attributes, int capacity)
	{
      super(name, attributes, capacity);
	}

	/**
	 * Reads an ARFF file from a reader, and assigns a weight of one to each 
	 * instance. Lets the index of the class attribute be undefined (negative).
	 *
	 * @param reader the reader
	 */
   public DynamicInstances(java.io.Reader reader) throws java.io.IOException
   {
      super(reader);
   }

	/**
	 * Get the source file that this DynamicInstances class was loaded from
	 *
	 * @return file name
	 */
   public String getSourceFile()
   {
      return this.sourceFile;
   }

	public void concatenate(Instances instances)
	{
      for(int i = 0; i < instances.numInstances(); i++)
      {
         Instance instance = instances.instance(i);
         instance.setDataset(this);
         this.add(instance);
      }
	}

	/**
	 * Set file name of the source files that was
	 * used to load this DynamicInstances instance
	 *
	 * @param sourceFile file name
	 */
   public void setSourceFile(String sourceFile)
   {
      this.sourceFile = sourceFile;
   }

}
